package com.caiden_micheal.dynamic.workflow.web;

import com.caiden_micheal.base.domain.AjxResult;
import com.caiden_micheal.dynamic.workflow.dto.*;
import com.caiden_micheal.dynamic.workflow.service.DWorkflowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dWorkflow")
public class DWorkflowController {
    @Autowired
    private DWorkflowService dWorkflowService;

    @PostMapping("/addDWorkflow")
    public AjxResult addDWorkflow(@RequestBody AddDWorkflowDTO addDWorkflowDTO) {
        return dWorkflowService.addDWorkflow(addDWorkflowDTO);
    }

    @PostMapping("/removeDWorkflow")
    public AjxResult removeDWorkflow(@RequestBody RemoveDWorkflow removeDWorkflow) {
        return dWorkflowService.removeDWorkflow(removeDWorkflow);
    }

    @PostMapping("/findDWorkflowPageQuery")
    public AjxResult findDWorkflowPageQuery(@RequestBody FindDWorkflowPageQueryDTO findDWorkflowPageQueryDTO) {
        return AjxResult.success(dWorkflowService.findDWorkflowByCondition(findDWorkflowPageQueryDTO));
    }

    @PostMapping("/findDWorkflowOne")
    public AjxResult findDWorkflowOne(@RequestBody FindDWorkflowOneDTO findDWorkflowOneDTO) {
        return dWorkflowService.findDWorkflowOne(findDWorkflowOneDTO);
    }

    @PostMapping("/findWorkflowSelectData")
    public AjxResult findWorkflowSelectData(@RequestBody FindWorkflowSelectDataDTO findWorkflowSelectDataDTO) {
        return dWorkflowService.findWorkflowSelectData(findWorkflowSelectDataDTO);
    }
}